package com.homwee.factory.pageData;

import java.util.List;

//zcj 2018-10-31 import android.os.SystemProperties;
import android.util.Log;

import com.homwee.factory.FactoryActivity;
import com.homwee.factory.R;
import com.homwee.listMenu.util.MenuItemData;

public class PageData6 extends PageData {

	MenuItemData MIUEnable;
	MenuItemData MIUModulation;
	MenuItemData MIUPercentage;
	MenuItemData MIUIndex;
	private int MiuIndexPage = 0;
	
	public PageData6(FactoryActivity mFactoryActivity) {
		super(mFactoryActivity);
	}

	public List<MenuItemData> LoadPageData() {
		mListItemData.clear();

		long startTime = System.currentTimeMillis();

		MenuItemData LvdsSSCEnable = new MenuItemData(0, "Lvds SSC Enable", 0,
				1, 1, 1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		LvdsSSCEnable.mInitValue = factorySetting.getLvdsSSCEnable();
		LvdsSSCEnable.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLvdsSSCEnable(value);
				// LvdsSSCEnable.updateValue(factorySetting.getLvdsSSCEnable());
			}
		});

		long endTime = System.currentTimeMillis();
		Log.v("tv1", "runtime:" + (endTime - startTime));

		MenuItemData LvdsSSCSpan = new MenuItemData(0, "Lvds SSC Span", 100,
				400, 0, 1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);

		endTime = System.currentTimeMillis();
		Log.v("tv1", "runtime:" + (endTime - startTime));

		endTime = System.currentTimeMillis();
		// LvdsSSCSpan.mInitValue =factorySetting.getLvdsSSCSpan()/100;
		LvdsSSCSpan.mInitValue = factorySetting.getLvdsSSCSpan();
		Log.v("tv2", "runtime:" + (System.currentTimeMillis() - endTime));

		LvdsSSCSpan.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				long eTime = System.currentTimeMillis();

				// factorySetting.setLvdsSSCSpan(value*100);
				factorySetting.setLvdsSSCSpan(value);
				Log.v("tv2", "runtime:" + (System.currentTimeMillis() - eTime));
				// LvdsSSCSpan.updateValue(factorySetting.getLvdsSSCSpan());
			}
		});

		endTime = System.currentTimeMillis();
		Log.v("tv2", "runtime:" + (endTime - startTime));

		MenuItemData LvdsSSCStep = new MenuItemData(0, "Lvds SSC Step", 0, 300,
				0, 1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		LvdsSSCStep.mInitValue = factorySetting.getLvdsSSCStep();
		LvdsSSCStep.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLvdsSSCStep(value);
				// LvdsSSCStep.updateValue(factorySetting.getLvdsSSCStep());
			}
		});

		endTime = System.currentTimeMillis();
		Log.v("tv3", "runtime:" + (endTime - startTime));

		MIUIndex = new MenuItemData(0, "MIU INDEX", 0, 1,
				0, 1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		MIUIndex.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				MiuIndexPage=value;
				
				MIUEnable.updateValue(factorySetting.getMIUEnable(value));
				MIUModulation.updateValue(factorySetting.getMIUModulation(value));
				MIUPercentage.updateValue(factorySetting.getMIUPercentage(value));
			}
		});
		
		MIUEnable = new MenuItemData(0, "MIU Enable", 1, 1,
				1, 1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		//MIUEnable.mInitValue = factorySetting.getMIUEnable(MIUIndex.mInitValue);
		MIUEnable.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setMIUEnable(MiuIndexPage,value);
			}
		});

		endTime = System.currentTimeMillis();
		Log.v("tv4", "runtime:" + (endTime - startTime));

	
		MIUModulation = new MenuItemData(0, "MIU Modulation", 20, 40,
				20, 1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		MIUModulation.mInitValue = factorySetting.getMIUModulation(MIUIndex.mInitValue);
		MIUModulation.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setMIUModulation(MiuIndexPage, value);
			}
		});

		endTime = System.currentTimeMillis();
		Log.v("tv5", "runtime:" + (endTime - startTime));

		MIUPercentage = new MenuItemData(0, "MIU Percentage", 1, 30, 0,
				1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		MIUPercentage.mInitValue = factorySetting.getMIUPercentage(MIUIndex.mInitValue);
		MIUPercentage.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setMIUPercentage(MiuIndexPage, value);
			}
		});

		endTime = System.currentTimeMillis();
		Log.v("tv6", "runtime:" + (endTime - startTime));

		MenuItemData LvdsSWing = null;
		LvdsSWing = new MenuItemData(0, "Lvds SWing", 40, 600, 0, 1,
				MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		LvdsSWing.mInitValue = factorySetting.getLvdsSwing();
		LvdsSWing.setOnValueChange(new MenuItemData.onValueChange() {

			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLvdsSwing(value);
				// MemSSCStep.updateValue(factorySetting.getMemSSCStep());
			}
		});

		mListItemData.add(LvdsSSCEnable);
		mListItemData.add(LvdsSSCSpan);
		mListItemData.add(LvdsSSCStep);
		mListItemData.add(LvdsSWing);
		// ///////////////////////////////
		//mListItemData.add(MIUIndex);
		mListItemData.add(MIUEnable);
		mListItemData.add(MIUModulation);
		mListItemData.add(MIUPercentage);

		endTime = System.currentTimeMillis();
		Log.v("tv7", "runtime:" + (endTime - startTime));

		// ////////////////////////////////////////////////////////////
		return mListItemData;
	}
}
